package days3.middle.title122;

/**
 * @Author fengzihao
 * @Date 2024-04-17 19:30
 */
class Solution {
    public int maxProfit(int[] prices) {
        int profits = 0;
        for (int i = 0; i < prices.length-1; i++) {
            if (prices[i]<prices[i+1])
                profits+=prices[i+1]-prices[i];
        }
        return profits;
    }
}